#pragma once

#include "stdafx.h"
#include "ControlEx.h"

#define WM_REMOVELISTITEM   WM_USER + 50
#define WM_ADDLISTITEM      WM_USER + 51

class CExplorerWnd : public WindowImplBase
{
public:
    CExplorerWnd();
    ~CExplorerWnd();

    virtual LPCTSTR    GetWindowClassName() const { return _T("DUIMainFrame"); }
    virtual CDuiString GetSkinFile() { return _T("skin\\ExplorerRes\\explorer.xml"); }
    virtual CDuiString GetSkinFolder() { return _T(""); }

    virtual CControlUI* CreateControl(LPCTSTR pstrClass);
    virtual void InitWindow();

    virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);

    virtual void Notify(TNotifyUI& msg);

    void RefreshFileList();

    static DWORD WINAPI RefreshFileListThread(LPVOID lpParameter);

private:
    CEditUI* m_pEditDir;
    CFileListUI* m_pList;
    CDialogBuilder m_dlgBuilder;

    TCHAR m_strDir[MAX_PATH] = {};

    struct Prama
    {
        HWND hWnd;
        std::wstring dir;
        CDialogBuilder* pBuilder;
        LPDWORD dwThreadID;
        LPBOOL bThreadRunning;
    };
    DWORD m_dwThreadID = 0;
    BOOL m_bThreadRunning = FALSE;
};
